#include <iostream>
#include <vector>

using namespace std;

const int N = 1e5 + 10;
int main()
{
	vector<int> a[N];

	int n, q, i, j, k;

	cin >> n >> q;

	while (q--)
	{
		int op;
		// 存放
		cin >> op >> i >> j;
		if (op == 1)
		{
			cin >> k;
			if(a[i].size() <= j)
				a[i].resize(j + 1);
			a[i][j] = k;
		}
		// 查询
		else
		{
			cout << a[i][j] << endl;	
		}
	}
	return 0;
}

